package kyssion.leetcode.num101_150;

public class code122_买股票的最佳时机2 {
    public static void main(String[] args) {

    }

    public int maxProfit(int[] prices) {
        int all =0;
        for(int a=1;a<prices.length;a++){
            if(prices[a]>=prices[a-1]){
                all+=prices[a]-prices[a-1];
            }
        }
        return all;
    }
}
